﻿using EFCoreDemo2.Entity;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace EFCoreDemo2.EntityConfig
{
    public class SubjectConfig : IEntityTypeConfiguration<Subject>
    {
        public void Configure(EntityTypeBuilder<Subject> builder)
        {
            builder.ToTable("T_Subject").ToTable(p => p.HasComment("科目表")).HasKey(p=>p.Id);
            builder.Property(p=>p.Name).HasColumnName("SubjectName").HasColumnType("nvarchar(50)").IsRequired();
            builder.Property(p => p.Score).HasColumnType("decimal(18,4)");
        }
    }
}
